/*
 * @lc app=leetcode.cn id=657 lang=typescript
 *
 * [657] 机器人能否返回原点
 */

// @lc code=start
function judgeCircle(moves: string): boolean {
    let cache = {
        U: 0,
        D: 0,
        L: 0,
        R: 0,
    };
    moves.split("").forEach((i) => {
        cache[i as keyof typeof cache]++;
    });
    if (cache.U === cache.D && cache.L === cache.R) {
        return true;
    } else {
        return false;
    }
}
// @lc code=end
